package com.gj.controller;

import com.gj.model.House;
import com.gj.service.HouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * author:guijie
 * date:${date}
 * description:TODO
 */
@RestController
@RequestMapping("/house")
public class HouseController {

    @Autowired
    private HouseService houseService;

    @RequestMapping("/insertHouse")
    public String insertHouse(){
        House house = new House();
        house.setHousename("碧桂园");
        houseService.insertHouse(house);
        return "success";
    }

    @RequestMapping("/upd")
    public String upd(Long houseId,String houseName){
        boolean flag = houseService.upd(houseId,houseName);
        if (!flag){
            return "fail";
        }
        return "success";
    }
}
